From: Maxim Ermilov Date: Sun, 24 Oct 2010 01:45:54 +0000 (+0400) Subject: dnd: Handle destruction of drag actor during drag X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~9624 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=95ac478f87f90377bc59e9af0cf894becc126d37;p=gnome-shell.git dnd: Handle destruction of drag actor during drag The shell crashes if the drag actor is destroyed during the drag operation. Cancel the drag gracefully in this case. https://bugzilla.gnome.org/show_bug.cgi?id=620389 --- diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 217a83982..9ebb2d400 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -86,6 +86,9 @@ _Draggable.prototype = { Lang.bind(this, this._onButtonPress)); this.actor.connect('destroy', Lang.bind(this, function() { + this._actorDestroyed = true; + if (this._dragInProgress) + this._cancelDrag(global.get_current_time()); this.disconnectAll(); })); this._onEventId = null; @@ -417,6 +420,8 @@ _Draggable.prototype = { targX, targY, event.get_time())) { + if (this._actorDestroyed) + return true; // If it accepted the drop without taking the actor, // handle it ourselves. if (this._dragActor.get_parent() == this._dragActor.get_stage()) { @@ -458,6 +463,12 @@ _Draggable.prototype = { this._dragInProgress = false; let [snapBackX, snapBackY] = this._getRestoreLocation(); + if (this._actorDestroyed) { + global.unset_cursor(); + this.emit('drag-end', eventTime, false); + return; + } + this._animationInProgress = true; // No target, so snap back Tweener.addTween(this._dragActor,